package com.sttk.fastMark.camera.adapter;

import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sttk.fastMark.camera.R;
import com.sttk.fastMark.camera.basic.ProviderMultiAdapter;
import com.sttk.fastMark.camera.bean.TemplateBean;


public class TemplateAdapter extends ProviderMultiAdapter<TemplateBean> {


    public TemplateAdapter() {
        addItemProvider(new TemplateProvider());
    }

    private class TemplateProvider extends BaseItemProvider<TemplateBean> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_template;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, TemplateBean bean) {
            baseViewHolder.setImageResource(R.id.ivTemplateItemImg, bean.getImg());
            if (bean.isSelected()) {
                baseViewHolder.getView(R.id.ivTemplateItemSel).setVisibility(View.VISIBLE);
            } else {
                baseViewHolder.getView(R.id.ivTemplateItemSel).setVisibility(View.GONE);
            }
        }
    }

}
